package com.cyf.smartCity.bean;

import com.cyf.db.bean.PayOrder;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 基本请求
 * Created by hfy on 2017/5/27.
 */
@ApiModel
@Data
public class ApiBusinessReq {

    public static final int PAYTYPE_UNKOWN = 0;
    /**
     * 支付宝
     **/
    public static final int PAYTYPE_ALIPAY = 1;
    /**
     * 微信
     **/
    public static final int PAYTYPE_WXPAY = 2;
    /**
     * 微信公众号
     **/
    public static final int PAYTYPE_WECHAT_JSAPI = 3;
    /**
     * 现金
     **/
    public static final int PAYTYPE_CASH = 4;
    /**
     * 刷卡支付
     **/
    public static final int PAYTYPE_CARD = 5;

    /**
     * 京东支付
     */
    public static final int PAYTYPE_JD = 7;

    /**
     * 优惠券
     */
    public static final int PAYTYPE_COUPON = 8;


    /**
     * 订单类型：0-支付停车费
     **/
    public static final int ORDERTYPE_PARKING_FEE = 0;
    /**
     * 订单类型：1-支付广告费
     **/
    public static final int ORDERTYPE_AD_FEE = 1;
    /**
     * 订单类型：2-服务工社报修费
     **/
    public static final int ORDERTYPE_SVR_REPAIR_FEE = 2;

    /**
     * 支付来源 1出入口 ------>安福通
     */
    public static final int PAY_RESOURCE_INOUT = 1;

    /**
     * 支付来源 7出入口  ----->安福通
     */
    public static final int PAY_RESOURCE_WECHAT = 7;

    @ApiModelProperty(value = "收费系统开放平台授权唯一标识", required = true)
    private String token;

//    1-支付宝 2-微信 3-微信公众号 4-现金 7-京东

    public static Integer convertPayType(Integer payOrderPayWay) {
        if (payOrderPayWay == null) {
            return PAYTYPE_UNKOWN;
        }
        switch (payOrderPayWay) {
            case PayOrder.PAY_WAY_ALIPAY:
                return PAYTYPE_ALIPAY;
            case PayOrder.PAY_WAY_WECHAT:
                return PAYTYPE_WXPAY;
            case PayOrder.PAY_WAY_WECHAT_JSAPI:
                return PAYTYPE_WECHAT_JSAPI;
            case PayOrder.PAY_WAY_CASH:
                return PAYTYPE_CASH;
            case PayOrder.PAY_WAY_JD:
                return PAYTYPE_JD;
            case PayOrder.PAY_WAY_COUPON:
                return PAYTYPE_COUPON;
            default: {
                return PAYTYPE_UNKOWN;
            }
        }
    }
}
